# CirruxCache provides dynamic HTTP caching on AppEngine (CDN like)
# Copyright (C) 2009 Samuel Alba <sam.alba@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

"""CirruxCache configuration file
"""

from lib import cache, redirect, forward, image
urls = {}


# EDIT BELOW

urls['default'] = (
        #'(/debug/.*)', 'Debug',
        '/getNoticies/([0-9]{1,})', 'config.Getnoticies',
        '/getIdeas/([0-9]{1,})', 'config.Getideas',
        '/getComentaris/([0-9]{1,})', 'config.Getcomentaris',
        '/xifrat(/.*)', 'config.Xifrat',
        )

# POP definition
# You can define and configure your Point Of Presence

class Getnoticies(cache.Service):
    origin = 'http://m.pirata.cat/request/proxyJsonMobile.php?rss&extradata='
    maxTTL = 300 # 5 min
    forceTTL = 300
    ignoreQueryString = True

class Getideas(cache.Service):
    origin = 'http://m.pirata.cat/request/proxyJsonMobile.php?up&extradata='
    maxTTL = 600 # 10 min
    forceTTL = 600
    ignoreQueryString = True

class Getcomentaris(cache.Service):
    origin = 'http://m.pirata.cat/request/proxyJsonMobile.php?id='
    maxTTL = 300 # 5 min
    forceTTL = 300
    ignoreQueryString = True

class Xifrat(cache.Service):
    origin = 'https://xifrat.pirata.cat'
    #allowFlushFrom = ['127.0.0.1']
    forceTTL = 600 # 10 min
    ignoreQueryString = False
    forwardPost = False
